﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using LinkCard.Dao;

namespace LinkCard.CustomerView
{
    public partial class AboutUs : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if(IsPostBack)
                return;

            int categoryid = 1;
            if (!string.IsNullOrEmpty(Page.RouteData.Values["cid"].ToString()))
            {
                if (!int.TryParse(Page.RouteData.Values["cid"].ToString(), out categoryid))
                {
                    categoryid = 1;
                }
            }
            
            Model.AboutUs about = new AboutUsDao().GetByCategoryId(categoryid);
            if (about == null) return;

            aboutCatName.Text = HttpUtility.HtmlDecode(about.Title);
            aboutContent.InnerHtml = HttpUtility.HtmlDecode(about.Content);

            Page.Title = about.Title + " - LinkCard";
            Page.MetaDescription = Page.Title;
        }
    }
}